<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button id="btn">点击获取</button>
    <script>
      let xhr = new XMLHttpRequest()
      xhr.open(
        'get',
        'http://pcapi-xiaotuxian-front-devtest.itheima.net/home/banner'
      )
      // 3.3 设置成功之后的回调函数onload
      xhr.onload = function () {
        // 3.4 返回的数据被保存在: response
        console.log(xhr.response)
      }
      xhr.send()
    </script>
  </body>
</html>
